package com.softeem.xyblogmaster.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.softeem.xyblogmaster.domain.Tags;
import com.softeem.xyblogmaster.service.TagsService;
import com.softeem.xyblogmaster.mapper.TagsMapper;
import com.softeem.xyblogmaster.util.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 段伟韬的笔记本
* @description 针对表【blog_tags】的数据库操作Service实现
* @createDate 2025-04-15 16:31:04
*/
@Service
public class TagsServiceImpl extends ServiceImpl<TagsMapper, Tags>
    implements TagsService{

        @Autowired
        private TagsMapper tagsMapper;
        @Override
        public PageInfo page(int page, int limit, String keyword) {
            LambdaQueryWrapper<Tags> lambdaQueryWrapper=new LambdaQueryWrapper();
            lambdaQueryWrapper.like(Tags::getName,"%"+keyword+"%");
            Page pages= this.page(new Page<Tags>(page, limit), lambdaQueryWrapper);
            PageInfo pageInfo=new PageInfo(pages,7);
            return pageInfo;
        }

    @Override
    public List<Tags> listTagsByArticleId(int articleId) {
        return tagsMapper.selectTagsByArticleId(articleId);
    }
}




